export default function reducer(state = {
    users: [],
    total: '', //用户数据总条数
    dept: [], //部门数据
    role: [], //角色数据
    totalRole: '', //角色数据总条数
    menus: [], //所有菜单数据
    totalMenu: '', //菜单数据总条数
}, action) {
    switch (action.type) {
        case "initUsers":
            return {...state, users: action.payload.rows, total: action.payload.total }
        case "initDept":
            return {...state, dept: action.payload }
        case "initRole":
            return {...state, role: action.payload.rows, totalRole: action.payload.total }
        case "initMenu":
            return {...state, menus: action.payload.rows.children, totalMenu: action.payload.total }



        default:
            return state
    }
}